package Network;

/**
 *Creates an instance of ButtonMessage, a Ubisense Message indicating that a
 * button on a tag has been pressed.
 *
 Copyright (C) 2009 BBC Research, Sam Davies, <Sam.Davies@bbc.co.uk>

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.


 */

public class ButtonMessage extends Message{

    private char orange;
    private char blue;
/**
 * Creates a new Button message instance when a button has been pressed.
 * 
 * @param messageType The hex code for the button message 0xBD
 * @param tag_id_bottom The Identifier for the tag
 * @param slot The time slot of the event
 * @param orange Flagged if the button pushed was orange
 * @param blue Flagged if the button pushed was blue
 */
    public ButtonMessage(char messageType, long tag_id_bottom, long slot, char orange, char blue) {
        super(messageType, tag_id_bottom, slot, 0);

        this.orange = orange;
        this.blue = blue;
    }


    /**
     * Returns the char datatype representing the Orange button
     * 
     * @return the orange
     */
    public char getOrange() {
        return orange;
    }

    /**
     * Returns the char datatype representing the Blue button
     * 
     * @return the blue
     */
    public char getBlue() {
        return blue;
    }

    @Override
    /**
     * Returns the buttons information.  Human friendly.
     */
    public String toString(){
        return("button Message. Tag Id; "+ this.getTag_id_bottom()+", slot; "+ this.getSlot()+"" +
                ", orange; "+ this.getOrange()+" Blue; "+ this.getBlue());
    }

}
